#include <iostream>
#include <map>
#include <set>
struct Student
{
    int id;
    std::string name;
};

int main()
{
    // std::pair<int, Student> s;
    // s.first = 1;
    // s.second = {1, "zhangsan"};

    std::pair<int, Student> s = std::make_pair<int, Student>(1,{1, "zhangsan"});
    std::pair<int, Student> s1 = std::make_pair<int, Student>(2,{2, "lisi"});

    std::map<int, Student> p;
    /* 遇到相同的键值，插不进去*/
    p.insert({3, {3, "wangwu"}});
    p.insert(s);
    p.insert(s1);

    /* 遇到相同的键值是修改value的值*/
    p[4] = {4, "zhangsan"};

    for(auto ite = p.begin(); ite != p.end(); ite++)
    {
        std::cout << ite->first << " " << ite->second.id<< " " << ite->second.name<<std::endl;
    }
    
    /* 可以快速的获取*/
    auto ite = p.find(2);
    std::cout<< ite->second.name << std::endl;

    return 0;
}